using System;
using FytSoa.Common.Extensions;
using FytSoa.Common.Utils;
using Masuit.Tools.Security;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using SqlSugar;
using System.Collections.Generic;

namespace FytSoa.Domain.Sys
{
    /// <summary>
    /// 资源菜单表
    /// </summary>
    [SugarTable("sys_menu")]
    public class SysMenu:Entity
    {
        /// <summary>
        /// 菜单名称
        /// </summary>
        [Required]
        [StringLength(30)]
        public string Name { get; set; }

        /// <summary>
        /// 父节点
        /// </summary>
        public long ParentId { get; set; }

        /// <summary>
        /// 父节点集合组
        /// </summary>
        public string ParentIdList { get; set; }

        /// <summary>
        /// 权限标识
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 菜单层级
        /// </summary>
        [Required]
        public int Layer { get; set; } = 0;

        /// <summary>
        /// 路由地址
        /// </summary>
        public string Urls { get; set; }

        /// <summary>
        /// 重定向
        /// </summary>
        public string Redirect { get; set; }

        /// <summary>
        /// Vue文件路径
        /// </summary>
        public string VuePath { get; set; }

        /// <summary>
        /// 菜单图标
        /// </summary>
        public string Icon { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        [Required]
        public int Sort { get; set; } = 1;

        /// <summary>
        /// 状态
        /// </summary>
        [Required]
        public bool Status { get; set; } = true;

        /// <summary>
        /// 是否删除
        /// </summary>
        [Required]
        public bool IsDel { get; set; } = false;

        /// <summary>
        /// 菜单类型：1=目录  2=菜单
        /// </summary>
        [Required]
        public int Types { get; set; } = 1;

        /// <summary>
        /// 菜单按钮
        /// </summary>
        [SugarColumn(IsJson = true)]
        public List<SysMenuBtnFun> BtnFun { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Required]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateUser { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string UpdateUser { get; set; }


    }

    /// <summary>
    /// 权限按钮对象信息
    /// </summary>
    public class SysMenuBtnFun
    {
        /// <summary>
        /// 唯一编号
        /// </summary>
        public string id { get; set; }

        /// <summary>
        /// 权限名称
        /// </summary>
        public string name { get; set; }

        /// <summary>
        /// 权限值
        /// </summary>
        public string value { get; set; }
    }
}